<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<meta name="copyright" content="www.apicloud.com" />
<meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
<title>修改密码</title>
<link rel="stylesheet" type="text/css" href="../css/api.css" />
<style>
	html {height: 100%;}
	body {height: 100%;width:100%;background-image:url(../image/login/yqdlbj.png);}

	input {height: 50px;font-size: 18px;color: #8E8C8C;width: 80%;}
	input::-webkit-input-placeholder {color: #ccc;}
	.clear_10{ width: 100%; height:10px;}
	.clear_20{ width: 100%; height:20px;}
	.top_logo{ width:90%; margin:0 5%;}
	.main_logo{ width:60%; margin:0 20%;}
	.divider {height: 15px;}
	.email,.passwd {/*margin-top: 3px;*/background: #fff;}
	.passwd img, .email img {vertical-align: top;}
	.item { width:90%; margin:0 5%;position: relative;}
	.email{-webkit-border-radius: 5px 5px 0px 0px;  border: 1px solid #B8B8B8;}
	.passwd1{ border-right: 1px solid #B8B8B8;border-left: 1px solid #B8B8B8; border-bottom: 1px solid #B8B8B8;}
	.passwd{-webkit-border-radius: 0px 0px 5px 5px; border-right: 1px solid #B8B8B8;border-left: 1px solid #B8B8B8; border-bottom: 1px solid #B8B8B8;}
	/*.email, .passwd, .btn {margin:3px 10px;}*/
	.btn {margin:3px 10px;}
	.btn {background: #3A8B7A;color: #fff;height: 40px; text-align: center; line-height: 40px; font-size: 20px;margin-top: 20px;border-radius: 5px;}
 	.email img {width: 25px; margin-top: 15px; margin-left: 10px; margin-right: 9px;}
	.passwd img {height: 25px;margin-top: 10px; margin-left: 10px;margin-right: 10px;}
	.passwd1 img {height: 25px;margin-top: 10px; margin-left: 10px;margin-right: 10px;}
	.secretword img {height: 25px;margin-top: 10px; margin-left: 10px;margin-right: 10px;}

	/* 底部样式 */
	.bottom {/*position: absolute;bottom: 0;*/width: 100%; text-align: center;/*padding-bottom: 20px;*/font-size: 12px;}
	.bottom img {height: 50px;}
	.bottom .arrow {text-align: center;margin: 10px 0;}
	.bottom .arrow img {width: 40px;height: 20px;}
	#qqpic {margin-right: 10px; margin-left: 10px;}
	.thirdinfo {color: #666;margin-top: 10px;}

	.secretword input {width: 50%;}
	.secretimg {position: absolute; right: 0; top: 0; height: 56px; margin-right: 10px; border-left: 1px solid #e0e0e0;}
	.secretimg img {height: 60%;}

    .thirdcompy>span {line-height: 40px;color: #999999; font-size: 1.2em;}
    .thirdcompy>span>a{line-height: 40px;color: blue; font-size: 1.2em;}
	.thirdcompy>span>a:hover{color: #999999;}
	.loginmore {margin-top: 10px;}
	.loginmore span {color: #0078ff;}
	.loginmore .forget {margin-left: 10px;}
	.loginmore .phone {margin-right: 10px;float: right;}

	.btnhover {background-color: #dcdcdc !important;}
	.buyhover {background-color: rgba(252, 85, 0, 0.6) !important;}
	.presshover {background-color: #FAFAFA !important;}
	.txthover {color: rgba(0, 120, 255, 0.6) !important;}
	input {outline: none;}
</style>
</head>
<body>
	<div class="form" >
		<div class="clear_20"></div>
		<div class="clear_20"></div>

		<div class="item email"><img src="../image/admin/password.png" alt=""><input name="old_password" type="password" placeholder="输入旧密码" id="old_password"></div>
		<div class="item passwd1"><img src="../image/admin/password.png" alt=""><input name="new_password" type="password" placeholder="输入新密码" id="new_password"></div>
		<div class="item passwd"><img src="../image/admin/password.png" alt=""><input name="new_password2" type="password" placeholder="确认新密码" id="new_password2"></div>

		<div class="clear_20"></div>
		<div class="clear_20"></div>
		<div class="btn" tapmode="buyhover" onclick="goto_updateUserPWDFun()">确  定</div>
	</div>
</body>
<script type="text/javascript" src="../script/api.js"></script>
<script type="text/javascript" src="../script/alpenlicebe.js"></script>
<script type="text/javascript" src="../script/zepto.min.js"></script>
<script type="text/javascript" src="../script/hashes.min.js"></script>
<script type="text/javascript">
   apiready = function() {

    };
	function goto_updateUserPWDFun() {
		var userID=Alpe_getLocalStorge('sys_userID');
    	var userPWD_old = $api.byId('old_password').value;
    	var userPWD_new1 = $api.byId('new_password').value;
    	var userPWD_new2 = $api.byId('new_password2').value;
    	if(''==userID){
    		api.alert({title:'系统提示',msg:'您未登录'});
			return;
    	}
    	if(''==userPWD_old){
    		api.alert({title:'系统提示',msg:'请输入您的旧密码'});
			return;
    	}
    	if(''==userPWD_new1){
    		api.alert({title:'系统提示',msg:'请输入您的新密码'});
			return;
    	}
    	if(''!=userPWD_new1&&userPWD_new1!=userPWD_new2){
    		api.alert({title:'系统提示',msg:'两次密码输入不一致'});
			return;
    	}
    	api.showProgress({
		    style: 'default',
		    animationType: 'fade',
		    title: '',
		    text: '',
		    modal: false
		});
		var MD5 = new Hashes.MD5;
       	var access_token = Alpe_getLocalStorge("access_token");
       	var admin_id = Alpe_getLocalStorge("admin_id");
       	var sign = MD5.hex(access_token+admin_id+'user/editPassword1.0syjqingbao');

       	var url = Alpe_ApiUrl+'r=user/editPassword&access_token='+access_token+'&admin_id='+admin_id
       		+'&new_password='+userPWD_new1+'&new_password2='+userPWD_new2+'&old_password='+userPWD_old
       		+'&v=1.0&sign='+sign;
        api.ajax({
	        url: url,
	        method: 'get',
	        cache: false,
	        timeout: 30,
	        dataType: 'json'
        }, function(ret, err){
      		if("002"==ret.success||"003"==ret.success){
				goto_openWin_loginWin(ret.message);
			}
			Alpe_setLocalStorge('password',userPWD_new1);
        	api.hideProgress();
			api.toast({
	             msg: ret.message,
                 duration:3000,
                 location: 'middle'
            });
	        $api.byId('old_password').value='';
	    	$api.byId('new_password').value='';
	    	$api.byId('new_password2').value='';
        });
	}
</script>
</html>
